{% extends 'base.html' %}

{% block title %}个人信息设置{% endblock %}

{% block container %}
  {{ super() }}
  <h2>设置个人信息</h2><br/>
  <ul class="nav nav-tabs">
    <li class="active"><a data-toggle="pill" href="#basic">基础信息</a></li>
    <li><a data-toggle="pill" href="#bind">账号绑定</a></li>
  </ul>

  <div class="tab-content">
    <div id="basic" class="tab-pane fade in active">
      <div class="col-md-4">
        <form role="form" method="POST">
          <br/>
          <div class="form-group">
            <label for="usr">昵称：</label>
            <input type="text" class="form-control" id="screenname" name="screenname" value="{{ current_user.screenname }}">
          </div>
          <div class="form-group">
            <label for="comment">自我介绍：</label>
            <textarea class="form-control" rows="5" id="description" name="description">{{ current_user.desc }}</textarea>
          </div>
          <button type="submit" class="btn btn-default btn-lg btn-block">提交</button>
        </form>
      </div>
    </div>
    <div id="bind" class="tab-pane fade">
      <div class="col-md-4">
        <br/>
        {% if current_user.binded('qq', current_user.id) %}
        <button type="button" class="btn btn-warning btn-lg btn-block" data-toggle="modal" data-target="#qqModal"><span class="glyphicon glyphicon-scissors"></span> 解绑 QQ 登陆</button>
        {% else %}
        <a href="{{ url_for('social.social_redirict', connect_type='qq') }}" type="button" class="btn btn-default btn-lg btn-block"><span class="glyphicon glyphicon-link"></span> 绑定 QQ 登陆</a>
        {% endif %}
        {% if current_user.binded('weibo', current_user.id) %}
        <button type="button" class="btn btn-warning btn-lg btn-block" data-toggle="modal" data-target="#weiboModal"><span class="glyphicon glyphicon-scissors"></span> 解绑微博登陆</button>
        {% else %}
        <a href="{{ url_for('social.social_redirict', connect_type='weibo') }}" type="button" class="btn btn-default btn-lg btn-block"><span class="glyphicon glyphicon-link"></span> 绑定微博登陆</a>
        {% endif %}
        {% if current_user.binded('douban', current_user.id) %}
        <button type="button" class="btn btn-warning btn-lg btn-block" data-toggle="modal" data-target="#doubanModal"><span class="glyphicon glyphicon-scissors"></span> 解绑豆瓣登陆</button>
        {% else %}
        <a href="{{ url_for('social.social_redirict', connect_type='douban') }}" type="button" class="btn btn-default btn-lg btn-block"><span class="glyphicon glyphicon-link"></span> 绑定豆瓣登陆</a>
        {% endif %}
      </div>
    </div>
  </div>

  <!-- Modal -->
  <div class="modal fade" id="qqModal" role="dialog">
    <div class="modal-dialog">

      <!-- Modal content-->
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title">真的要解绑吗？</h4>
        </div>
        <div class="modal-body">
          {% if only_one_bind %}
          <p>这是你最后一个登陆的方式，删除之后将不能再登陆，账号会丢失，确定要删除吗？</p>
          {% else %}
          <p>解除绑定之后不能用这个账号来登陆，确定要删除吗？</p>
          {% endif %}
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
          <a href="{{ url_for('social.unbind', oauth_name='qq') }}" type="button" class="btn btn-default btn-warning">确定解绑</a>
        </div>
      </div>

    </div>
  </div>
  <!-- Modal -->
  <div class="modal fade" id="weiboModal" role="dialog">
    <div class="modal-dialog">

      <!-- Modal content-->
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title">真的要解绑吗？</h4>
        </div>
        <div class="modal-body">
          {% if only_one_bind %}
          <p>这是你最后一个登陆的方式，删除之后将不能再登陆，账号会丢失，确定要删除吗？</p>
          {% else %}
          <p>解除绑定之后不能用这个账号来登陆，确定要删除吗？</p>
          {% endif %}
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
          <a href="{{ url_for('social.unbind', oauth_name='weibo') }}" type="button" class="btn btn-default btn-warning">确定解绑</a>
        </div>
      </div>

    </div>
  </div>
  <!-- Modal -->
  <div class="modal fade" id="doubanModal" role="dialog">
    <div class="modal-dialog">

      <!-- Modal content-->
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title">真的要解绑吗？</h4>
        </div>
        <div class="modal-body">
          {% if only_one_bind %}
          <p>这是你最后一个登陆的方式，删除之后将不能再登陆，账号会丢失，确定要删除吗？</p>
          {% else %}
          <p>解除绑定之后不能用这个账号来登陆，确定要删除吗？</p>
          {% endif %}
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
          <a href="{{ url_for('social.unbind', oauth_name='douban') }}" type="button" class="btn btn-default btn-warning">确定解绑</a>
        </div>
      </div>

    </div>
  </div>
{% endblock %}
